package mgr;

import java.io.*;
import java.util.LinkedList;
import java.util.List;

public class JMAS {

	public static List<Instruction> readFile(String text) throws Exception {

		String vett[], line;

		BufferedReader buff = new BufferedReader(new FileReader(text));
		List<Instruction> instructionList = new LinkedList<Instruction>();
		while ((line = buff.readLine()) != null) {

			vett = line.split("[,]");

			instructionList.add(getInstruction(vett));
		}
		return instructionList;
	}

	public static Instruction getInstruction(String[] v) {
		if (v[1].equalsIgnoreCase("w")) {
			return new Instruction(v[0], 0, v[2], v[3]);
		} else if (v[1].equalsIgnoreCase("r")) {
			return new Instruction(v[0], 1, v[2], v[3]);
		} else
			return null;
	}

	public static void main(String[] args) throws Exception {
		for (Instruction i : readFile("input.txt")) {
			System.out.println(i);
		}

	}

}
